package com.yaoyao.Trail_demo;

import java.util.Scanner;

public class case3 {
    public static void main(String[] args) {
        System.out.println(getAverageScore(10));
    }

    public static double getAverageScore(int number) {
        // 1、定义一个动态初始化的数组，负责后期存入评委的打分
        int[] scores = new int[number];
        System.out.println("请输入评委们的分数");
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < scores.length; i++) {
            scores[i] = sc.nextInt();
        }
        int sum = 0;
        int temp;
        for (int i = 0; i < scores.length; i++) {
            sum += scores[i];
        }
        for (int i = 0; i < scores.length; i++) {
            for (int j = 0; j < scores.length - 1; j++) {
                if (scores[j] >= scores[j + 1]) {
                    temp = scores[j];
                    scores[j] = scores[j + 1];
                    scores[j + 1] = temp;
                }
            }
        }
        return (sum - (scores[0] + scores[scores.length - 1])) * 1.0 / (number - 2);

    }
}
